$(document).ready(function() {
	UserProfile.init();
});

UserProfile = {};

UserProfile.init = function() {
	//Contact Seller
	$('#userProfileLinkContact').bind('click', function() {
		$('#userProfileContactDialog').dialog({
			resizable : false,
			modal : true,
			minWidth: 500,
			draggable : false,
			buttons : [ {
				text : $('#userProfileContactDialogOk').text(),
				click : function() {
					var inputUser = $('#userProfileContactInputUser').val();
					var inputMessage = $('#userProfileContactInputMessage').val();
					if(inputMessage.trim() != ''){
						var link = $('#userProfileLinkContact').attr('link');
						$.post(link, {
							recipient: inputUser,
							message : inputMessage
						});
						$('#userProfileContactInputMessage').val('');
						$(this).dialog("close");
					}
				}
			}, {
				text : $('#userProfileContactDialogCancel').text(),
				click : function() {
					$(this).dialog("close");
				}
			} ]
		});
		return false;
	});
}